import java.util.Scanner;

public class mysqlTest {
    public static void main(String args[]){
        Scanner in=new Scanner(System.in);
        Scanner on = new Scanner(System.in);
        boolean loop = true;
        while(loop){
            System.out.println("1.增加");
            System.out.println("2.删除");
            System.out.println("3.更改");
            System.out.println("4.查询");
            System.out.println("5.退出");
            int x = on.nextInt();
            loop=menu(x);
        }

    }

    private static boolean menu(int x) {

            String Student_id;
            String Sname;
            String Ssex;
            int Sage;
            String Dept_id;
            String Sclass;
            DBConnection db=new DBConnection();
            Scanner on = new Scanner(System.in);
            switch(x){
                case 1:
                    System.out.println("学生学号，姓名，年龄，性别，输入学院，班级：");
                    System.out.println("学号");
                    Student_id=on.next();
                    System.out.println("姓名");
                     Sname=on.next();
                    System.out.println("年龄");
                     Sage= Integer.parseInt(String.valueOf(on.nextInt()));
                    System.out.println("性别");
                     Ssex= on.next();
                    System.out.println("学院编号");
                     Dept_id=on.next();
                    System.out.println("班级编号");
                     Sclass=on.next();
                    db.addUser(Student_id,Sname,Sage,Ssex,Dept_id,Sclass);
                    return true;
                case 2:
                    System.out.println("请输入要删除学生学号");
                    Student_id = on.next();
                    db.del(Student_id);
                    return true;
                case 3:
                    System.out.println("请输入要修改的学号：");
                    System.out.println("学号");
                    Student_id = on.next();
                    System.out.println("请输入修改的姓名：");
                    Sname= on.next();
                    System.out.println("请输入修改的年龄");
                    Sage= Integer.parseInt(String.valueOf(on.nextInt()));
                    System.out.println("请输入修改的性别");
                    Ssex= on.next();
                    System.out.println("请输入修改的学院编号");
                    Dept_id= on.next();
                    System.out.println("请输入修改的课程编号");
                    Sclass= on.next();
                    db.update(Student_id, Sname,Sage,Ssex,Dept_id,Sclass);
                    return true;
                case 4:
                    db.select();
                    return true;



            }

        return false;
    }


}
